const app = getApp();

Component({
	data: {
		tabBarChoice: null,
		selected: 0,
		list: [{
				title: '首页',
				iconType: 'custom-icon-home1',
				selectedIconType: 'custom-icon-home-fill',
				path: '/pages/index/index'
			},
			{
				title: '分类',
				iconType: 'custom-icon-all',
				selectedIconType: 'custom-icon-all-fill',
				path: '/pages/shopClassification/shopClassification',
			},

			{
				title: '购物车',
				iconType: 'custom-icon-cart-empty',
				selectedIconType: 'custom-icon-cart-empty-fill',
				path: '/pages/shopCar/shopCar'
			},
			{
				title: '我的',
				iconType: 'custom-icon-customer',
				selectedIconType: 'custom-icon-customer-fill',
				path: '/pages/mine/mine'
			}
		],
		listCloseBtn: [{
				title: '首页',
				iconType: 'custom-icon-home1',
				selectedIconType: 'custom-icon-home-fill',
				path: '/pages/index/index'
			},
			{
				title: '分类',
				iconType: 'custom-icon-all',
				selectedIconType: 'custom-icon-all-fill',
				path: '/pages/shopClassification/shopClassification',
			},
			{
				title: '购物车',
				iconType: 'custom-icon-cart-empty',
				selectedIconType: 'custom-icon-cart-empty-fill',
				path: '/pages/shopCar/shopCar',
			},
			{
				title: '我的',
				iconType: 'custom-icon-customer',
				selectedIconType: 'custom-icon-customer-fill',
				path: '/pages/mine/mine'
			}
		]
	},
	// attached() {
	// 	var that = this;
	// 	var is_close_message = 0;
	// 	wx.request({
	// 		url: 'https://lynk.fanxingzhida.com/Yh/Index/getOpenMesasge', //仅为示例，并非真实的接口地址
	// 		data: {},
	// 		header: {
	// 			'content-type': 'application/json' // 默认值
	// 		},
	// 		success(res) {
	// 			that.setData({
	// 				tabBarChoice: res.data.is_close_message_3
	// 			});

	// 		},
	// 		error(e) {
	// 			console.log(e);
	// 		}
	// 	})
	// 	console.log(this.data.tabBarChoice);
	// },
	methods: {
		targetTabbar(e) {
			var that = this;
			var is_close_message = 0;
			// wx.request({
			// 	url: 'https://lynk.fanxingzhida.com/Yh/Index/getOpenMesasge', //仅为示例，并非真实的接口地址
			// 	data: {},
			// 	header: {
			// 		'content-type': 'application/json' // 默认值
			// 	},
			// 	success(res) {
			// 		that.setData({
			// 			tabBarChoice: res.data.is_close_message_3
			// 		});
			// 	},
			// 	error(e) {
			// 		console.log(e);
			// 	}
			// })
			const index = e.currentTarget.dataset.index;
			const url = e.currentTarget.dataset.path;
			wx.switchTab({
				url
			});
			this.setData({
				selected: index,
			});
			// console.log(e, 'tabbar');
		},
	},
});